package tables

import (
	"github.com/GoAdminGroup/go-admin/context"
	"github.com/GoAdminGroup/go-admin/modules/db"
	"github.com/GoAdminGroup/go-admin/plugins/admin/modules/table"
	"github.com/GoAdminGroup/go-admin/template/types/form"
)

// GetAlipayTemplate return the model of table alipay_templates.
func GetAlipayTemplate(ctx *context.Context) (stTable table.Table) {

	stTable = table.NewDefaultTable(table.DefaultConfigWithDriver("postgresql"))

	info := stTable.GetInfo()
	info.AddField("ID", "id", db.Int).FieldSortable()
	info.AddField("模版ID", "template_id", db.Varchar)
	info.AddField("模版版本", "template_version", db.Varchar)
	info.AddField("应用版本", "app_version", db.Varchar)
	info.AddField("版本描述", "version_desc", db.Varchar)
	info.AddField("投放端", "bundle_id", db.Varchar)

	info.SetTable("alipay_template").SetTitle("支付宝小程序模版").SetDescription("支付宝小程序模版")

	formList := stTable.GetForm()
	formList.AddField("ID", "id", db.Int, form.Default).FieldDisplayButCanNotEditWhenUpdate().FieldDisableWhenCreate()
	formList.AddField("模版ID", "template_id", db.Varchar, form.Text)
	formList.AddField("模版版本", "template_version", db.Varchar, form.Text)
	formList.AddField("应用版本", "app_version", db.Varchar, form.Text)
	formList.AddField("版本描述", "version_desc", db.Varchar, form.Text)
	formList.AddField("投放端", "bundle_id", db.Varchar, form.Text)

	formList.SetTable("alipay_template").SetTitle("支付宝小程序模版").SetDescription("支付宝小程序模版")

	return
}
